<?php

namespace App\Http\Requests;

use App\Models\Order;
use Illuminate\Validation\Rule;

/**
 * 确认收货
 * Class ReceiptOrderRequest
 * @package App\Http\Requests
 */
class ReceiptOrderRequest extends BaseRequest
{

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'order_id' => [
                Rule::exists('orders', 'id')->where("user_id", $this->user()->id)
                    ->whereNotNull('paid_at')
                    ->where('ship_status', '!=', Order::SHIP_STATUS_PENDING)
            ]
        ];
    }
}
